import request from "@/utils/request";

// 获取分类列表
const CategoryList = (params) => {
    return request({
        url: "/categories",
        params: {
            ...params
        }
    });
};
// 添加分类
const AddCategory = (data) => {
    return request({
        url: "/categories",
        method: "post",
        data
    });
};

// 删除分类
const DeleteCategory = (id) => {
    return request({
        url: `/categories/${id}`,
        method: "delete"
    });
};

// 修改分类
const UpdateCategory = (id, data) => {
    return request({
        url: `/categories/${id}`,
        method: "patch",
        data
    });
};

export { CategoryList, AddCategory, DeleteCategory, UpdateCategory };
